#include "ObjectHelper.h"

using namespace std;
using namespace glm;

class Camera {
    public:
        vec3 location;
        vec3 up;
        vec3 right;
        vec3 look_at;
    
        Camera() {
            location = vec3();
            up = vec3();
            right = vec3();
            look_at = vec3();
        }
        
        Camera(vector<string> input) {
            int index = 1;
            location = vec3();
            up = vec3();
            right = vec3();
            look_at = vec3();
        
            assert(input[0] == "camera");
            
            while (index < input.size()) {
                if (input[index] == "location") {
                    istringstream(input[index + 1]) >> location.x;
                    istringstream(input[index + 2]) >> location.y;
                    istringstream(input[index + 3]) >> location.z;
                }
                else if (input[index] == "up") {
                    istringstream(input[index + 1]) >> up.x;
                    istringstream(input[index + 2]) >> up.y;
                    istringstream(input[index + 3]) >> up.z;
                }
                else if (input[index] == "right") {
                    istringstream(input[index + 1]) >> right.x;
                    istringstream(input[index + 2]) >> right.y;
                    istringstream(input[index + 3]) >> right.z;
                }
                else if (input[index] == "look_at") {
                    istringstream(input[index + 1]) >> look_at.x;
                    istringstream(input[index + 2]) >> look_at.y;
                    istringstream(input[index + 3]) >> look_at.z;
                }
                else {
                    cout << "Unknown modifier found for camera: " << input[index] << endl;
                    assert(0);
                }
                
                index += 4;
            }
        }
};
